//fis.set('project.files', '*.html');

fis.hook('amd', {
  //globalAsyncAsSync: true,
  baseUrl: "r/",
  paths: {
    //依赖库
    "jQuery": "bower_components/jquery/dist/jquery.min",
    "jquery": "bower_components/jquery/dist/jquery.min",
    "jquery-validation": "bower_components/jquery-validation/dist/jquery.validate.min",
    "alertify-origin": "bower_components/alertify/alertify.min",
    "alertify": "static/js/alertify-config",
    "webuploader": "bower_components/fex-webuploader/dist/webuploader",
    "bootstrap": "bower_components/bootstrap/dist/js/bootstrap.min",
    "chart": "bower_components/Chart.js/Chart.min.js",
    "metisMenu": "bower_components/metisMenu/dist/metisMenu.min",
    "underscore": "bower_components/underscore/underscore-min",
    "umeditor-config": "vendor/umeditor/umeditor.config",
    "umeditor": "vendor/umeditor/umeditor",
    "umeditorLangZH": "vendor/umeditor/lang/zh-cn/zh-cn",
    "hxz": "static/js/hxz/hxz",
    "hxzValid": "static/js/hxz/hxz.valid",
    "hxzUI": "static/js/hxz/hxz.ui",
    "hxzRest": "static/js/hxz/hxz.rest",
    "raphael": "bower_components/raphael/raphael.min",
    "morris": "bower_components/morrisjs/morris.min",
    "pagination": "vendor/pagination/jquery.pagination",
    "async": "bower_components/async/dist/async.min",
    "select2": "bower_components/select2/dist/js/select2",
    "moment": "bower_components/moment/min/moment-with-zh-cn.min",
    "bootstrap-daterangepicker": "bower_components/bootstrap-daterangepicker/daterangepicker",
    "cropper": "bower_components/cropper/dist/cropper.min",
    "smalot-bootstrap-datetimepicker": "bower_components/smalot-bootstrap-datetimepicker/js/bootstrap-datetimepicker.min",
    "jquery-qrcode": "bower_components/jquery-qrcode/jquery.qrcode.min",
    "otherPlayerMeta": "static/js/data/other-player-meta"
  },
  shim: {
    "jquery-qrcode": {
      deps: ["jquery"]
    },
    "smalot-bootstrap-datetimepicker": {
      deps: ["jquery", "bootstrap"]
    },
    async: {
      exports: "async"
    },
    select2: {
      deps: ["jquery"]
    },
    alertify: {
      deps: ["jquery"],
      exports: "alertify"
    },
    webuploader: {
      deps: ["jQuery"]
      //exports: "WebUploader"
    },
    //underscore: {
      //exports: "_"
    //},
    pagination: {
      deps: ["jquery"]
    },
    bootstrap: {
      deps: ["jquery"]
    },
    metisMenu: {
      deps: ["jquery", "bootstrap"]
    },
    umeditor: {
      deps: ["jquery", "umeditor-config"],
      exports: "UM"
    },
    umeditorLangZH: {
      deps: ["umeditor", "umeditor-config"],
      exports: "UM"
    },
    raphael: {
      deps: ["jquery"],
      exports: "Raphael"
    },
    morris: {
      deps: ["jquery"],
      exports: "Morris"
    },
    "bootstrap-daterangepicker": {
      deps: ["jquery", "moment"],
      exports: "$.fn.daterangepicker"
    },
    "cropper": {
      deps: ["jquery"]
    }
  }
});

//fis.match('/r/vendor/**.js', {
//  isMod: true // 设置 /bower_components/ 下都是一些组件，组件建议都是匿名方式 define
//});

fis.match('**', {
  release : '$0',
  url : '/server$0'
});

fis.match('::package', {
  // npm install [-g] fis3-postpackager-loader
  // 分析 __RESOURCE_MAP__ 结构，来解决资源加载问题
  postpackager: fis.plugin('loader', {
    resourceType: 'amd',
    useInlineMap: true // 资源映射表内嵌
  })
});

fis
  .media('dev')

  .match('**', {
    deploy: fis.plugin('local-deliver', {
      to: '../target/activity/server'
    })
  });

// fis3 release production
fis
  .media('prod')
  
  .match('/r/static/js/**.js', {
    // fis-optimizer-uglify-js 插件进行压缩，已内置
    useHash: true,
    optimizer: fis.plugin('uglify-js')
  })

  .match('/r/static/css/**.css', {
    // fis-optimizer-clean-css 插件进行压缩，已内置
    useHash: true,
    optimizer: fis.plugin('clean-css')
  })

  .match('**', {
    deploy: fis.plugin('local-deliver', {
      to: '../src/main/webapp/server'
    })
  });
